/* 弹窗基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 400px;
  height: 600px;
  min-width: 400px;
  min-height: 600px;
  max-width: 400px;
  max-height: 600px;
  overflow: hidden;
}

.container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 导航标签 */
.nav-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 16px;
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #2196F3;
  background: #f5f5f5;
}

.tab-btn.active {
  color: #2196F3;
  border-bottom-color: #2196F3;
  font-weight: 500;
}

/* 标签内容 */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tab-content.active {
  display: block;
}





.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#translate-input {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: #fff;
}

#translate-input:focus {
  outline: none;
  border-color: #2196F3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.input-actions {
  display: flex;
  gap: 8px;
}

/* 按钮样式 */
.primary-btn {
  background: #2196F3;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.primary-btn:hover {
  background: #1976D2;
}

.secondary-btn {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: #e0e0e0;
  color: #333;
}

.danger-btn {
  background: #f44336;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s ease;
}

.danger-btn:hover {
  background: #d32f2f;
}

/* 结果区域 */
.result-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fafafa;
  border-bottom: 1px solid #e0e0e0;
}

.result-title {
  font-weight: 600;
  color: #333;
  font-size: 13px;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.result-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #666;
  transition: all 0.2s ease;
}

.result-actions button:hover {
  background: #f0f0f0;
  color: #333;
}

.result-content {
  padding: 16px;
}

.original-result {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  word-wrap: break-word;
}

.translated-result {
  font-size: 14px;
  color: #2196F3;
  font-weight: 500;
  margin-bottom: 12px;
  word-wrap: break-word;
}

.result-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #999;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.service-result {
  background: #e3f2fd;
  color: #1976d2;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

/* 历史记录和收藏页面 */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-header h3 {
  font-size: 16px;
  color: #333;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  width: 150px;
}

.search-input:focus {
  outline: none;
  border-color: #2196F3;
}

/* 列表样式 */
.history-list,
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.history-item,
.favorite-item {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s ease;
}

.history-item:hover,
.favorite-item:hover {
  border-color: #2196F3;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.item-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
  padding: 12px;
}

.item-content:hover {
  background-color: #f5f5f5;
}

.favorite-item .item-content:hover {
  background-color: #e3f2fd;
}

.item-text {
  margin-bottom: 8px;
}

.original-item {
  font-size: 13px;
  color: #333;
  margin-bottom: 4px;
  word-wrap: break-word;
}

.translated-item {
  font-size: 13px;
  color: #2196F3;
  font-weight: 500;
  word-wrap: break-word;
}

.item-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #999;
}

.service-item {
  background: #e3f2fd;
  color: #1976d2;
  padding: 1px 4px;
  border-radius: 2px;
}

.item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #666;
  transition: all 0.2s ease;
}

.item-actions button:hover {
  background: #f0f0f0;
  color: #333;
}

.remove-favorite-btn:hover {
  color: #f44336;
}

/* 编辑模式样式 */
.edit-translated-input {
  width: 100%;
  padding: 6px 8px;
  border: 2px solid #2196F3;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  margin-bottom: 6px;
  box-sizing: border-box;
  cursor: text;
}

.edit-translated-input:focus {
  outline: none;
  border-color: #1976D2;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
  background: #fafafa;
}

/* 只读原文样式 */
.readonly-original {
  display: block;
  padding: 6px 8px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  cursor: default;
}

/* 编辑状态下的项目样式 */
.favorite-item[data-editing="true"] {
  background: #e3f2fd;
  border-color: #2196F3;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

/* 编辑按钮样式 */
.save-edit-btn,
.cancel-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.save-edit-btn:hover {
  background: #e8f5e8;
  color: #2e7d32 !important;
}

.cancel-edit-btn:hover {
  background: #ffebee;
  color: #c62828 !important;
}

/* 设置页面 */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.setting-group {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 16px;
}

.setting-group h3 {
  font-size: 14px;
  color: #333;
  margin-bottom: 12px;
  font-weight: 600;
}

.setting-item {
  margin-bottom: 16px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 4px;
}

.setting-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.setting-text {
  font-size: 13px;
  color: #333;
  font-weight: 500;
}

.setting-desc {
  font-size: 12px;
  color: #666;
  margin-left: 24px;
}

.setting-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}

.setting-select:focus {
  outline: none;
  border-color: #2196F3;
}

/* API配置 */
.api-config {
  margin-bottom: 16px;
}

.api-config:last-child {
  margin-bottom: 0;
}

.api-config h4 {
  font-size: 13px;
  color: #333;
  margin-bottom: 8px;
  font-weight: 500;
}

.input-field {
  margin-bottom: 12px;
}

.input-field:last-child {
  margin-bottom: 0;
}

.input-field label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.input-field input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}

.input-field input:focus {
  outline: none;
  border-color: #2196F3;
}

.api-info {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
  border-left: 3px solid #2196F3;
}

.api-info p {
  margin: 0;
  line-height: 1.4;
}

.api-info a {
  color: #2196F3;
  text-decoration: none;
}

.api-info a:hover {
  text-decoration: underline;
}

.setting-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 480px) {
  body {
    width: 100vw;
  }
  
  .nav-tabs {
    padding: 0 8px;
  }
  
  .tab-content {
    padding: 12px;
  }
  
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .header-actions {
    justify-content: space-between;
  }
  
  .search-input {
    width: 100%;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  body {
    background: #1e1e1e;
    color: #e0e0e0;
  }
  
  .nav-tabs {
    background: #2d2d2d;
    border-bottom-color: #444;
  }
  
  .tab-btn {
    color: #bbb;
  }
  
  .tab-btn:hover {
    background: #3d3d3d;
  }
  
  .tab-btn.active {
    color: #64b5f6;
    border-bottom-color: #64b5f6;
  }
  
  #translate-input,
  .result-section,
  .history-item,
  .favorite-item,
  .setting-group {
    background: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
  }
  
  #translate-input:focus,
  .setting-select:focus,
  .input-field input:focus {
    border-color: #64b5f6;
  }
  
  .result-header {
    background: #3d3d3d;
    border-bottom-color: #444;
  }
  
  .translated-result,
  .translated-item {
    color: #64b5f6;
  }
  
  .service-result,
  .service-item {
    background: #1e3a5f;
    color: #64b5f6;
  }
  
  .search-input,
  .setting-select,
  .input-field input {
    background: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
  }
  
  .secondary-btn {
    background: #3d3d3d;
    border-color: #444;
    color: #bbb;
  }
  
  .secondary-btn:hover {
    background: #4d4d4d;
    color: #e0e0e0;
  }
} 